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