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 as published by
7 # the Free Software Foundation, either version 3 of the License, or
8 # (at your option) any later version.
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.
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/>.
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, \
23 from nepi.resources.ns3.ns3netdevice import NS3BaseNetDevice
26 class NS3BaseStationNetDevice(NS3BaseNetDevice):
27 _rtype = "ns3::BaseStationNetDevice"
30 def _register_attributes(cls):
32 attr_initialranginterval = Attribute("InitialRangInterval",
33 "Time between Initial Ranging regions assigned by the BS. Maximum is 2s",
35 default = "+50000000.0ns",
38 flags = Flags.Reserved | Flags.Construct)
40 cls._register_attribute(attr_initialranginterval)
42 attr_dcdinterval = Attribute("DcdInterval",
43 "Time between transmission of DCD messages. Maximum value is 10s.",
45 default = "+3000000000.0ns",
48 flags = Flags.Reserved | Flags.Construct)
50 cls._register_attribute(attr_dcdinterval)
52 attr_ucdinterval = Attribute("UcdInterval",
53 "Time between transmission of UCD messages. Maximum value is 10s.",
55 default = "+3000000000.0ns",
58 flags = Flags.Reserved | Flags.Construct)
60 cls._register_attribute(attr_ucdinterval)
62 attr_intervalt8 = Attribute("IntervalT8",
63 "Wait for DSA/DSC Acknowledge timeout. Maximum 300ms.",
65 default = "+50000000.0ns",
68 flags = Flags.Reserved | Flags.Construct)
70 cls._register_attribute(attr_intervalt8)
72 attr_rangreqoppsize = Attribute("RangReqOppSize",
73 "The ranging opportunity size in symbols",
78 flags = Flags.Reserved | Flags.Construct)
80 cls._register_attribute(attr_rangreqoppsize)
82 attr_bwreqoppsize = Attribute("BwReqOppSize",
83 "The bandwidth request opportunity size in symbols",
88 flags = Flags.Reserved | Flags.Construct)
90 cls._register_attribute(attr_bwreqoppsize)
92 attr_maxrangcorrectionretries = Attribute("MaxRangCorrectionRetries",
93 "Number of retries on contention Ranging Requests",
98 flags = Flags.Reserved | Flags.Construct)
100 cls._register_attribute(attr_maxrangcorrectionretries)
102 attr_mtu = Attribute("Mtu",
103 "The MAC-level Maximum Transmission Unit",
104 type = Types.Integer,
108 flags = Flags.Reserved | Flags.Construct)
110 cls._register_attribute(attr_mtu)
112 attr_rtg = Attribute("RTG",
113 "receive/transmit transition gap.",
114 type = Types.Integer,
118 flags = Flags.Reserved | Flags.Construct)
120 cls._register_attribute(attr_rtg)
122 attr_ttg = Attribute("TTG",
123 "transmit/receive transition gap.",
124 type = Types.Integer,
128 flags = Flags.Reserved | Flags.Construct)
130 cls._register_attribute(attr_ttg)
135 def _register_traces(cls):
137 bstx = Trace("BSTx", "A packet has been received from higher layers and is being processed in preparation for queueing for transmission.")
139 cls._register_trace(bstx)
141 bstxdrop = Trace("BSTxDrop", "A packet has been dropped in the MAC layer before being queued for transmission.")
143 cls._register_trace(bstxdrop)
145 bspromiscrx = Trace("BSPromiscRx", "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,")
147 cls._register_trace(bspromiscrx)
149 bsrx = Trace("BSRx", "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,")
151 cls._register_trace(bsrx)
153 bsrxdrop = Trace("BSRxDrop", "A packet has been dropped in the MAC layer after it has been passed up from the physical layer.")
155 cls._register_trace(bsrxdrop)
157 rx = Trace("Rx", "Receive trace")
159 cls._register_trace(rx)
161 tx = Trace("Tx", "Transmit trace")
163 cls._register_trace(tx)
167 def __init__(self, ec, guid):
168 super(NS3BaseStationNetDevice, self).__init__(ec, guid)
169 self._home = "ns3-base-station-net-device-%s" % self.guid