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.ns3base import NS3Base
25 class NS3dsrDsrRouting(NS3Base):
26 _rtype = "ns3::dsr::DsrRouting"
29 def _register_attributes(cls):
31 attr_maxsendbufflen = Attribute("MaxSendBuffLen",
32 "Maximum number of packets that can be stored in send buffer.",
37 flags = Flags.Reserved | Flags.Construct)
39 cls._register_attribute(attr_maxsendbufflen)
41 attr_maxsendbufftime = Attribute("MaxSendBuffTime",
42 "Maximum time packets can be queued in the send buffer .",
44 default = "+30000000000.0ns",
47 flags = Flags.Reserved | Flags.Construct)
49 cls._register_attribute(attr_maxsendbufftime)
51 attr_maxmaintlen = Attribute("MaxMaintLen",
52 "Maximum number of packets that can be stored in maintenance buffer.",
57 flags = Flags.Reserved | Flags.Construct)
59 cls._register_attribute(attr_maxmaintlen)
61 attr_maxmainttime = Attribute("MaxMaintTime",
62 "Maximum time packets can be queued in maintenance buffer.",
64 default = "+30000000000.0ns",
67 flags = Flags.Reserved | Flags.Construct)
69 cls._register_attribute(attr_maxmainttime)
71 attr_maxcachelen = Attribute("MaxCacheLen",
72 "Maximum number of route entries that can be stored in route cache.",
77 flags = Flags.Reserved | Flags.Construct)
79 cls._register_attribute(attr_maxcachelen)
81 attr_routecachetimeout = Attribute("RouteCacheTimeout",
82 "Maximum time the route cache can be queued in route cache.",
84 default = "+300000000000.0ns",
87 flags = Flags.Reserved | Flags.Construct)
89 cls._register_attribute(attr_routecachetimeout)
91 attr_maxentrieseachdst = Attribute("MaxEntriesEachDst",
92 "Maximum number of route entries for a single destination to respond.",
97 flags = Flags.Reserved | Flags.Construct)
99 cls._register_attribute(attr_maxentrieseachdst)
101 attr_sendbuffinterval = Attribute("SendBuffInterval",
102 "How often to check send buffer for packet with route.",
104 default = "+500000000000.0ns",
107 flags = Flags.Reserved | Flags.Construct)
109 cls._register_attribute(attr_sendbuffinterval)
111 attr_nodetraversaltime = Attribute("NodeTraversalTime",
112 "The time it takes to traverse two neighboring nodes.",
114 default = "+40000000.0ns",
117 flags = Flags.Reserved | Flags.Construct)
119 cls._register_attribute(attr_nodetraversaltime)
121 attr_rreqretries = Attribute("RreqRetries",
122 "Maximum number of retransmissions for request discovery of a route.",
123 type = Types.Integer,
127 flags = Flags.Reserved | Flags.Construct)
129 cls._register_attribute(attr_rreqretries)
131 attr_maintenanceretries = Attribute("MaintenanceRetries",
132 "Maximum number of retransmissions for data packets from maintenance buffer.",
133 type = Types.Integer,
137 flags = Flags.Reserved | Flags.Construct)
139 cls._register_attribute(attr_maintenanceretries)
141 attr_requesttablesize = Attribute("RequestTableSize",
142 "Maximum number of request entries in the request table, set this as the number of nodes in the simulation.",
143 type = Types.Integer,
147 flags = Flags.Reserved | Flags.Construct)
149 cls._register_attribute(attr_requesttablesize)
151 attr_requestidsize = Attribute("RequestIdSize",
152 "Maximum number of request source Ids in the request table.",
153 type = Types.Integer,
157 flags = Flags.Reserved | Flags.Construct)
159 cls._register_attribute(attr_requestidsize)
161 attr_uniquerequestidsize = Attribute("UniqueRequestIdSize",
162 "Maximum number of request Ids in the request table for a single destination.",
163 type = Types.Integer,
167 flags = Flags.Reserved | Flags.Construct)
169 cls._register_attribute(attr_uniquerequestidsize)
171 attr_nonproprequesttimeout = Attribute("NonPropRequestTimeout",
172 "The timeout value for non-propagation request.",
174 default = "+30000000.0ns",
177 flags = Flags.Reserved | Flags.Construct)
179 cls._register_attribute(attr_nonproprequesttimeout)
181 attr_discoveryhoplimit = Attribute("DiscoveryHopLimit",
182 "The max discovery hop limit for route requests.",
183 type = Types.Integer,
187 flags = Flags.Reserved | Flags.Construct)
189 cls._register_attribute(attr_discoveryhoplimit)
191 attr_maxsalvagecount = Attribute("MaxSalvageCount",
192 "The max salvage count for a single data packet.",
193 type = Types.Integer,
197 flags = Flags.Reserved | Flags.Construct)
199 cls._register_attribute(attr_maxsalvagecount)
201 attr_blacklisttimeout = Attribute("BlacklistTimeout",
202 "The time for a neighbor to stay in blacklist.",
204 default = "+3000000000.0ns",
207 flags = Flags.Reserved | Flags.Construct)
209 cls._register_attribute(attr_blacklisttimeout)
211 attr_gratreplyholdoff = Attribute("GratReplyHoldoff",
212 "The time for gratuitous reply entry to expire.",
214 default = "+1000000000.0ns",
217 flags = Flags.Reserved | Flags.Construct)
219 cls._register_attribute(attr_gratreplyholdoff)
221 attr_broadcastjitter = Attribute("BroadcastJitter",
222 "The jitter time to avoid collision for broadcast packets.",
223 type = Types.Integer,
227 flags = Flags.Reserved | Flags.Construct)
229 cls._register_attribute(attr_broadcastjitter)
231 attr_linkacktimeout = Attribute("LinkAckTimeout",
232 "The time a packet in maintenance buffer wait for link acknowledgment.",
234 default = "+100000000.0ns",
237 flags = Flags.Reserved | Flags.Construct)
239 cls._register_attribute(attr_linkacktimeout)
241 attr_trylinkacks = Attribute("TryLinkAcks",
242 "The number of link acknowledgment to use.",
243 type = Types.Integer,
247 flags = Flags.Reserved | Flags.Construct)
249 cls._register_attribute(attr_trylinkacks)
251 attr_passiveacktimeout = Attribute("PassiveAckTimeout",
252 "The time a packet in maintenance buffer wait for passive acknowledgment.",
254 default = "+100000000.0ns",
257 flags = Flags.Reserved | Flags.Construct)
259 cls._register_attribute(attr_passiveacktimeout)
261 attr_trypassiveacks = Attribute("TryPassiveAcks",
262 "The number of passive acknowledgment to use.",
263 type = Types.Integer,
267 flags = Flags.Reserved | Flags.Construct)
269 cls._register_attribute(attr_trypassiveacks)
271 attr_requestperiod = Attribute("RequestPeriod",
272 "The base time interval between route requests.",
274 default = "+500000000.0ns",
277 flags = Flags.Reserved | Flags.Construct)
279 cls._register_attribute(attr_requestperiod)
281 attr_maxrequestperiod = Attribute("MaxRequestPeriod",
282 "The max time interval between route requests.",
284 default = "+10000000000.0ns",
287 flags = Flags.Reserved | Flags.Construct)
289 cls._register_attribute(attr_maxrequestperiod)
291 attr_grareplytablesize = Attribute("GraReplyTableSize",
292 "The gratuitous reply table size.",
293 type = Types.Integer,
297 flags = Flags.Reserved | Flags.Construct)
299 cls._register_attribute(attr_grareplytablesize)
301 attr_cachetype = Attribute("CacheType",
302 "Use Link Cache or use Path Cache",
304 default = "LinkCache",
307 flags = Flags.Reserved | Flags.Construct)
309 cls._register_attribute(attr_cachetype)
311 attr_stabilitydecrfactor = Attribute("StabilityDecrFactor",
312 "The stability decrease factor for link cache",
313 type = Types.Integer,
317 flags = Flags.Reserved | Flags.Construct)
319 cls._register_attribute(attr_stabilitydecrfactor)
321 attr_stabilityincrfactor = Attribute("StabilityIncrFactor",
322 "The stability increase factor for link cache",
323 type = Types.Integer,
327 flags = Flags.Reserved | Flags.Construct)
329 cls._register_attribute(attr_stabilityincrfactor)
331 attr_initstability = Attribute("InitStability",
332 "The initial stability factor for link cache",
334 default = "+25000000000.0ns",
337 flags = Flags.Reserved | Flags.Construct)
339 cls._register_attribute(attr_initstability)
341 attr_minlifetime = Attribute("MinLifeTime",
342 "The minimal life time for link cache",
344 default = "+1000000000.0ns",
347 flags = Flags.Reserved | Flags.Construct)
349 cls._register_attribute(attr_minlifetime)
351 attr_useextends = Attribute("UseExtends",
352 "The extension time for link cache",
354 default = "+120000000000.0ns",
357 flags = Flags.Reserved | Flags.Construct)
359 cls._register_attribute(attr_useextends)
361 attr_enablesubroute = Attribute("EnableSubRoute",
362 "Enables saving of sub route when receiving route error messages, only available when using path route cache",
367 flags = Flags.Reserved | Flags.Construct)
369 cls._register_attribute(attr_enablesubroute)
371 attr_retransincr = Attribute("RetransIncr",
372 "The increase time for retransmission timer when facing network congestion",
374 default = "+20000000.0ns",
377 flags = Flags.Reserved | Flags.Construct)
379 cls._register_attribute(attr_retransincr)
381 attr_maxnetworkqueuesize = Attribute("MaxNetworkQueueSize",
382 "The max number of packet to save in the network queue.",
383 type = Types.Integer,
387 flags = Flags.Reserved | Flags.Construct)
389 cls._register_attribute(attr_maxnetworkqueuesize)
391 attr_maxnetworkqueuedelay = Attribute("MaxNetworkQueueDelay",
392 "The max time for a packet to stay in the network queue.",
394 default = "+30000000000.0ns",
397 flags = Flags.Reserved | Flags.Construct)
399 cls._register_attribute(attr_maxnetworkqueuedelay)
401 attr_numpriorityqueues = Attribute("NumPriorityQueues",
402 "The max number of packet to save in the network queue.",
403 type = Types.Integer,
407 flags = Flags.Reserved | Flags.Construct)
409 cls._register_attribute(attr_numpriorityqueues)
411 attr_linkacknowledgment = Attribute("LinkAcknowledgment",
412 "Enable Link layer acknowledgment mechanism",
417 flags = Flags.Reserved | Flags.Construct)
419 cls._register_attribute(attr_linkacknowledgment)
421 attr_protocolnumber = Attribute("ProtocolNumber",
422 "The Ip protocol number.",
423 type = Types.Integer,
427 flags = Flags.Reserved | Flags.Construct)
429 cls._register_attribute(attr_protocolnumber)
434 def _register_traces(cls):
436 tx = Trace("Tx", "Send DSR packet.")
438 cls._register_trace(tx)
440 drop = Trace("Drop", "Drop DSR packet")
442 cls._register_trace(drop)
446 def __init__(self, ec, guid):
447 super(NS3dsrDsrRouting, self).__init__(ec, guid)
448 self._home = "ns3-dsr-dsr-routing-%s" % self.guid