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