cdb1ebc1a5dd309a85517c051c05acbd933c5d7e
[nepi.git] / src / nepi / resources / ns3 / classes / ocb_wifi_mac.py
1 #
2 #    NEPI, a framework to manage network experiments
3 #    Copyright (C) 2014 INRIA
4 #
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.
9 #
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.
14 #
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/>.
17 #
18
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 
24
25 @clsinit_copy
26 class NS3OcbWifiMac(NS3BaseWifiMac):
27     _rtype = "ns3::OcbWifiMac"
28
29     @classmethod
30     def _register_attributes(cls):
31         
32         attr_qossupported = Attribute("QosSupported",
33             "This Boolean attribute is set to enable 802.11e/WMM-style QoS support at this STA",
34             type = Types.Bool,
35             default = "False",  
36             allowed = None,
37             range = None,    
38             flags = Flags.Reserved | Flags.Construct)
39
40         cls._register_attribute(attr_qossupported)
41
42         attr_htsupported = Attribute("HtSupported",
43             "This Boolean attribute is set to enable 802.11n support at this STA",
44             type = Types.Bool,
45             default = "False",  
46             allowed = None,
47             range = None,    
48             flags = Flags.Reserved | Flags.Construct)
49
50         cls._register_attribute(attr_htsupported)
51
52         attr_ctstoselfsupported = Attribute("CtsToSelfSupported",
53             "Use CTS to Self when using a rate that is not in the basic set rate",
54             type = Types.Bool,
55             default = "False",  
56             allowed = None,
57             range = None,    
58             flags = Flags.Reserved | Flags.Construct)
59
60         cls._register_attribute(attr_ctstoselfsupported)
61
62         attr_ctstimeout = Attribute("CtsTimeout",
63             "When this timeout expires, the RTS/CTS handshake has failed.",
64             type = Types.String,
65             default = "+75000.0ns",  
66             allowed = None,
67             range = None,    
68             flags = Flags.Reserved | Flags.Construct)
69
70         cls._register_attribute(attr_ctstimeout)
71
72         attr_acktimeout = Attribute("AckTimeout",
73             "When this timeout expires, the DATA/ACK handshake has failed.",
74             type = Types.String,
75             default = "+75000.0ns",  
76             allowed = None,
77             range = None,    
78             flags = Flags.Reserved | Flags.Construct)
79
80         cls._register_attribute(attr_acktimeout)
81
82         attr_basicblockacktimeout = Attribute("BasicBlockAckTimeout",
83             "When this timeout expires, the BASIC_BLOCK_ACK_REQ/BASIC_BLOCK_ACK handshake has failed.",
84             type = Types.String,
85             default = "+281000.0ns",  
86             allowed = None,
87             range = None,    
88             flags = Flags.Reserved | Flags.Construct)
89
90         cls._register_attribute(attr_basicblockacktimeout)
91
92         attr_compressedblockacktimeout = Attribute("CompressedBlockAckTimeout",
93             "When this timeout expires, the COMPRESSED_BLOCK_ACK_REQ/COMPRESSED_BLOCK_ACK handshake has failed.",
94             type = Types.String,
95             default = "+107000.0ns",  
96             allowed = None,
97             range = None,    
98             flags = Flags.Reserved | Flags.Construct)
99
100         cls._register_attribute(attr_compressedblockacktimeout)
101
102         attr_sifs = Attribute("Sifs",
103             "The value of the SIFS constant.",
104             type = Types.String,
105             default = "+16000.0ns",  
106             allowed = None,
107             range = None,    
108             flags = Flags.Reserved | Flags.Construct)
109
110         cls._register_attribute(attr_sifs)
111
112         attr_eifsnodifs = Attribute("EifsNoDifs",
113             "The value of EIFS-DIFS",
114             type = Types.String,
115             default = "+60000.0ns",  
116             allowed = None,
117             range = None,    
118             flags = Flags.Reserved | Flags.Construct)
119
120         cls._register_attribute(attr_eifsnodifs)
121
122         attr_slot = Attribute("Slot",
123             "The duration of a Slot.",
124             type = Types.String,
125             default = "+9000.0ns",  
126             allowed = None,
127             range = None,    
128             flags = Flags.Reserved | Flags.Construct)
129
130         cls._register_attribute(attr_slot)
131
132         attr_pifs = Attribute("Pifs",
133             "The value of the PIFS constant.",
134             type = Types.String,
135             default = "+25000.0ns",  
136             allowed = None,
137             range = None,    
138             flags = Flags.Reserved | Flags.Construct)
139
140         cls._register_attribute(attr_pifs)
141
142         attr_rifs = Attribute("Rifs",
143             "The value of the RIFS constant.",
144             type = Types.String,
145             default = "+2000.0ns",  
146             allowed = None,
147             range = None,    
148             flags = Flags.Reserved | Flags.Construct)
149
150         cls._register_attribute(attr_rifs)
151
152         attr_maxpropagationdelay = Attribute("MaxPropagationDelay",
153             "The maximum propagation delay. Unused for now.",
154             type = Types.String,
155             default = "+3333.0ns",  
156             allowed = None,
157             range = None,    
158             flags = Flags.Reserved | Flags.Construct)
159
160         cls._register_attribute(attr_maxpropagationdelay)
161
162         attr_ssid = Attribute("Ssid",
163             "The ssid we want to belong to.",
164             type = Types.String,
165             default = "default",  
166             allowed = None,
167             range = None,    
168             flags = Flags.Reserved | Flags.Construct)
169
170         cls._register_attribute(attr_ssid)
171
172
173
174     @classmethod
175     def _register_traces(cls):
176         
177         txokheader = Trace("TxOkHeader", "The header of successfully transmitted packet")
178
179         cls._register_trace(txokheader)
180
181         txerrheader = Trace("TxErrHeader", "The header of unsuccessfully transmitted packet")
182
183         cls._register_trace(txerrheader)
184
185         mactx = Trace("MacTx", "A packet has been received from higher layers and is being processed in preparation for queueing for transmission.")
186
187         cls._register_trace(mactx)
188
189         mactxdrop = Trace("MacTxDrop", "A packet has been dropped in the MAC layer before being queued for transmission.")
190
191         cls._register_trace(mactxdrop)
192
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,")
194
195         cls._register_trace(macpromiscrx)
196
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,")
198
199         cls._register_trace(macrx)
200
201         macrxdrop = Trace("MacRxDrop", "A packet has been dropped in the MAC layer after it has been passed up from the physical layer.")
202
203         cls._register_trace(macrxdrop)
204
205
206
207     def __init__(self, ec, guid):
208         super(NS3OcbWifiMac, self).__init__(ec, guid)
209         self._home = "ns3-ocb-wifi-mac-%s" % self.guid