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 NS3MeshWifiInterfaceMac(NS3BaseWifiMac):
26 _rtype = "ns3::MeshWifiInterfaceMac"
29 def _register_attributes(cls):
31 attr_beaconinterval = Attribute("BeaconInterval",
34 default = "+500000000.0ns",
37 flags = Flags.Reserved | Flags.Construct)
39 cls._register_attribute(attr_beaconinterval)
41 attr_randomstart = Attribute("RandomStart",
42 "Window when beacon generating starts (uniform random) in seconds",
44 default = "+500000000.0ns",
47 flags = Flags.Reserved | Flags.Construct)
49 cls._register_attribute(attr_randomstart)
51 attr_beacongeneration = Attribute("BeaconGeneration",
52 "Enable/Disable Beaconing.",
57 flags = Flags.Reserved | Flags.Construct)
59 cls._register_attribute(attr_beacongeneration)
61 attr_qossupported = Attribute("QosSupported",
62 "This Boolean attribute is set to enable 802.11e/WMM-style QoS support at this STA",
67 flags = Flags.Reserved | Flags.Construct)
69 cls._register_attribute(attr_qossupported)
71 attr_htsupported = Attribute("HtSupported",
72 "This Boolean attribute is set to enable 802.11n support at this STA",
77 flags = Flags.Reserved | Flags.Construct)
79 cls._register_attribute(attr_htsupported)
81 attr_ctstoselfsupported = Attribute("CtsToSelfSupported",
82 "Use CTS to Self when using a rate that is not in the basic set rate",
87 flags = Flags.Reserved | Flags.Construct)
89 cls._register_attribute(attr_ctstoselfsupported)
91 attr_ctstimeout = Attribute("CtsTimeout",
92 "When this timeout expires, the RTS/CTS handshake has failed.",
94 default = "+75000.0ns",
97 flags = Flags.Reserved | Flags.Construct)
99 cls._register_attribute(attr_ctstimeout)
101 attr_acktimeout = Attribute("AckTimeout",
102 "When this timeout expires, the DATA/ACK handshake has failed.",
104 default = "+75000.0ns",
107 flags = Flags.Reserved | Flags.Construct)
109 cls._register_attribute(attr_acktimeout)
111 attr_basicblockacktimeout = Attribute("BasicBlockAckTimeout",
112 "When this timeout expires, the BASIC_BLOCK_ACK_REQ/BASIC_BLOCK_ACK handshake has failed.",
114 default = "+281000.0ns",
117 flags = Flags.Reserved | Flags.Construct)
119 cls._register_attribute(attr_basicblockacktimeout)
121 attr_compressedblockacktimeout = Attribute("CompressedBlockAckTimeout",
122 "When this timeout expires, the COMPRESSED_BLOCK_ACK_REQ/COMPRESSED_BLOCK_ACK handshake has failed.",
124 default = "+107000.0ns",
127 flags = Flags.Reserved | Flags.Construct)
129 cls._register_attribute(attr_compressedblockacktimeout)
131 attr_sifs = Attribute("Sifs",
132 "The value of the SIFS constant.",
134 default = "+16000.0ns",
137 flags = Flags.Reserved | Flags.Construct)
139 cls._register_attribute(attr_sifs)
141 attr_eifsnodifs = Attribute("EifsNoDifs",
142 "The value of EIFS-DIFS",
144 default = "+60000.0ns",
147 flags = Flags.Reserved | Flags.Construct)
149 cls._register_attribute(attr_eifsnodifs)
151 attr_slot = Attribute("Slot",
152 "The duration of a Slot.",
154 default = "+9000.0ns",
157 flags = Flags.Reserved | Flags.Construct)
159 cls._register_attribute(attr_slot)
161 attr_pifs = Attribute("Pifs",
162 "The value of the PIFS constant.",
164 default = "+25000.0ns",
167 flags = Flags.Reserved | Flags.Construct)
169 cls._register_attribute(attr_pifs)
171 attr_rifs = Attribute("Rifs",
172 "The value of the RIFS constant.",
174 default = "+2000.0ns",
177 flags = Flags.Reserved | Flags.Construct)
179 cls._register_attribute(attr_rifs)
181 attr_maxpropagationdelay = Attribute("MaxPropagationDelay",
182 "The maximum propagation delay. Unused for now.",
184 default = "+3333.0ns",
187 flags = Flags.Reserved | Flags.Construct)
189 cls._register_attribute(attr_maxpropagationdelay)
191 attr_ssid = Attribute("Ssid",
192 "The ssid we want to belong to.",
197 flags = Flags.Reserved | Flags.Construct)
199 cls._register_attribute(attr_ssid)
204 def _register_traces(cls):
206 txokheader = Trace("TxOkHeader", "The header of successfully transmitted packet")
208 cls._register_trace(txokheader)
210 txerrheader = Trace("TxErrHeader", "The header of unsuccessfully transmitted packet")
212 cls._register_trace(txerrheader)
214 mactx = Trace("MacTx", "A packet has been received from higher layers and is being processed in preparation for queueing for transmission.")
216 cls._register_trace(mactx)
218 mactxdrop = Trace("MacTxDrop", "A packet has been dropped in the MAC layer before being queued for transmission.")
220 cls._register_trace(mactxdrop)
222 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,")
224 cls._register_trace(macpromiscrx)
226 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,")
228 cls._register_trace(macrx)
230 macrxdrop = Trace("MacRxDrop", "A packet has been dropped in the MAC layer after it has been passed up from the physical layer.")
232 cls._register_trace(macrxdrop)
236 def __init__(self, ec, guid):
237 super(NS3MeshWifiInterfaceMac, self).__init__(ec, guid)
238 self._home = "ns3-mesh-wifi-interface-mac-%s" % self.guid