README moves to markdown
[nepi.git] / src / nepi / resources / ns3 / classes / aarfcd_wifi_manager.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.ns3wifiremotestationmanager import NS3BaseWifiRemoteStationManager 
23
24 @clsinit_copy
25 class NS3AarfcdWifiManager(NS3BaseWifiRemoteStationManager):
26     _rtype = "ns3::AarfcdWifiManager"
27
28     @classmethod
29     def _register_attributes(cls):
30         
31         attr_successk = Attribute("SuccessK",
32             "Multiplication factor for the success threshold in the AARF algorithm.",
33             type = Types.Double,
34             default = "2",  
35             allowed = None,
36             range = None,    
37             flags = Flags.Reserved | Flags.Construct)
38
39         cls._register_attribute(attr_successk)
40
41         attr_timerk = Attribute("TimerK",
42             "Multiplication factor for the timer threshold in the AARF algorithm.",
43             type = Types.Double,
44             default = "2",  
45             allowed = None,
46             range = None,    
47             flags = Flags.Reserved | Flags.Construct)
48
49         cls._register_attribute(attr_timerk)
50
51         attr_maxsuccessthreshold = Attribute("MaxSuccessThreshold",
52             "Maximum value of the success threshold in the AARF algorithm.",
53             type = Types.Integer,
54             default = "60",  
55             allowed = None,
56             range = None,    
57             flags = Flags.Reserved | Flags.Construct)
58
59         cls._register_attribute(attr_maxsuccessthreshold)
60
61         attr_mintimerthreshold = Attribute("MinTimerThreshold",
62             "The minimum value for the \'timer\' threshold in the AARF algorithm.",
63             type = Types.Integer,
64             default = "15",  
65             allowed = None,
66             range = None,    
67             flags = Flags.Reserved | Flags.Construct)
68
69         cls._register_attribute(attr_mintimerthreshold)
70
71         attr_minsuccessthreshold = Attribute("MinSuccessThreshold",
72             "The minimum value for the success threshold in the AARF algorithm.",
73             type = Types.Integer,
74             default = "10",  
75             allowed = None,
76             range = None,    
77             flags = Flags.Reserved | Flags.Construct)
78
79         cls._register_attribute(attr_minsuccessthreshold)
80
81         attr_minrtswnd = Attribute("MinRtsWnd",
82             "Minimum value for Rts window of Aarf-CD",
83             type = Types.Integer,
84             default = "1",  
85             allowed = None,
86             range = None,    
87             flags = Flags.Reserved | Flags.Construct)
88
89         cls._register_attribute(attr_minrtswnd)
90
91         attr_maxrtswnd = Attribute("MaxRtsWnd",
92             "Maximum value for Rts window of Aarf-CD",
93             type = Types.Integer,
94             default = "40",  
95             allowed = None,
96             range = None,    
97             flags = Flags.Reserved | Flags.Construct)
98
99         cls._register_attribute(attr_maxrtswnd)
100
101         attr_turnoffrtsafterratedecrease = Attribute("TurnOffRtsAfterRateDecrease",
102             "If true the RTS mechanism will be turned off when the rate will be decreased",
103             type = Types.Bool,
104             default = "True",  
105             allowed = None,
106             range = None,    
107             flags = Flags.Reserved | Flags.Construct)
108
109         cls._register_attribute(attr_turnoffrtsafterratedecrease)
110
111         attr_turnonrtsafterrateincrease = Attribute("TurnOnRtsAfterRateIncrease",
112             "If true the RTS mechanism will be turned on when the rate will be increased",
113             type = Types.Bool,
114             default = "True",  
115             allowed = None,
116             range = None,    
117             flags = Flags.Reserved | Flags.Construct)
118
119         cls._register_attribute(attr_turnonrtsafterrateincrease)
120
121         attr_islowlatency = Attribute("IsLowLatency",
122             "If true, we attempt to modelize a so-called low-latency device: a device where decisions about tx parameters can be made on a per-packet basis and feedback about the transmission of each packet is obtained before sending the next. Otherwise, we modelize a  high-latency device, that is a device where we cannot update our decision about tx parameters after every packet transmission.",
123             type = Types.Bool,
124             default = "True",  
125             allowed = None,
126             range = None,    
127             flags = Flags.Reserved | Flags.Construct)
128
129         cls._register_attribute(attr_islowlatency)
130
131         attr_maxssrc = Attribute("MaxSsrc",
132             "The maximum number of retransmission attempts for an RTS. This value will not have any effect on some rate control algorithms.",
133             type = Types.Integer,
134             default = "7",  
135             allowed = None,
136             range = None,    
137             flags = Flags.Reserved | Flags.Construct)
138
139         cls._register_attribute(attr_maxssrc)
140
141         attr_maxslrc = Attribute("MaxSlrc",
142             "The maximum number of retransmission attempts for a DATA packet. This value will not have any effect on some rate control algorithms.",
143             type = Types.Integer,
144             default = "7",  
145             allowed = None,
146             range = None,    
147             flags = Flags.Reserved | Flags.Construct)
148
149         cls._register_attribute(attr_maxslrc)
150
151         attr_rtsctsthreshold = Attribute("RtsCtsThreshold",
152             "If  the size of the data packet + LLC header + MAC header + FCS trailer is bigger than this value, we use an RTS/CTS handshake before sending the data, as per IEEE Std. 802.11-2012, Section 9.3.5. This value will not have any effect on some rate control algorithms.",
153             type = Types.Integer,
154             default = "2346",  
155             allowed = None,
156             range = None,    
157             flags = Flags.Reserved | Flags.Construct)
158
159         cls._register_attribute(attr_rtsctsthreshold)
160
161         attr_fragmentationthreshold = Attribute("FragmentationThreshold",
162             "If the size of the data packet + LLC header + MAC header + FCS trailer is biggerthan this value, we fragment it such that the size of the fragments are equal or smaller than this value, as per IEEE Std. 802.11-2012, Section 9.5. This value will not have any effect on some rate control algorithms.",
163             type = Types.Integer,
164             default = "2346",  
165             allowed = None,
166             range = None,    
167             flags = Flags.Reserved | Flags.Construct)
168
169         cls._register_attribute(attr_fragmentationthreshold)
170
171         attr_nonunicastmode = Attribute("NonUnicastMode",
172             "Wifi mode used for non-unicast transmissions.",
173             type = Types.String,
174             default = "Invalid-WifiMode",  
175             allowed = None,
176             range = None,    
177             flags = Flags.Reserved | Flags.Construct)
178
179         cls._register_attribute(attr_nonunicastmode)
180
181         attr_defaulttxpowerlevel = Attribute("DefaultTxPowerLevel",
182             "Default power level to be used for transmissions. This is the power level that is used by all those WifiManagers that do notimplement TX power control.",
183             type = Types.Integer,
184             default = "0",  
185             allowed = None,
186             range = None,    
187             flags = Flags.Reserved | Flags.Construct)
188
189         cls._register_attribute(attr_defaulttxpowerlevel)
190
191
192
193     @classmethod
194     def _register_traces(cls):
195         
196         mactxrtsfailed = Trace("MacTxRtsFailed", "The transmission of a RTS by the MAC layer has failed")
197
198         cls._register_trace(mactxrtsfailed)
199
200         mactxdatafailed = Trace("MacTxDataFailed", "The transmission of a data packet by the MAC layer has failed")
201
202         cls._register_trace(mactxdatafailed)
203
204         mactxfinalrtsfailed = Trace("MacTxFinalRtsFailed", "The transmission of a RTS has exceeded the maximum number of attempts")
205
206         cls._register_trace(mactxfinalrtsfailed)
207
208         mactxfinaldatafailed = Trace("MacTxFinalDataFailed", "The transmission of a data packet has exceeded the maximum number of attempts")
209
210         cls._register_trace(mactxfinaldatafailed)
211
212
213
214     def __init__(self, ec, guid):
215         super(NS3AarfcdWifiManager, self).__init__(ec, guid)
216         self._home = "ns3-aarfcd-wifi-manager-%s" % self.guid