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.ns3netdevice import NS3BaseNetDevice
25 class NS3BaseStationNetDevice(NS3BaseNetDevice):
26 _rtype = "ns3::BaseStationNetDevice"
29 def _register_attributes(cls):
31 attr_initialranginterval = Attribute("InitialRangInterval",
32 "Time between Initial Ranging regions assigned by the BS. Maximum is 2s",
34 default = "+50000000.0ns",
37 flags = Flags.Reserved | Flags.Construct)
39 cls._register_attribute(attr_initialranginterval)
41 attr_dcdinterval = Attribute("DcdInterval",
42 "Time between transmission of DCD messages. Maximum value is 10s.",
44 default = "+3000000000.0ns",
47 flags = Flags.Reserved | Flags.Construct)
49 cls._register_attribute(attr_dcdinterval)
51 attr_ucdinterval = Attribute("UcdInterval",
52 "Time between transmission of UCD messages. Maximum value is 10s.",
54 default = "+3000000000.0ns",
57 flags = Flags.Reserved | Flags.Construct)
59 cls._register_attribute(attr_ucdinterval)
61 attr_intervalt8 = Attribute("IntervalT8",
62 "Wait for DSA/DSC Acknowledge timeout. Maximum 300ms.",
64 default = "+50000000.0ns",
67 flags = Flags.Reserved | Flags.Construct)
69 cls._register_attribute(attr_intervalt8)
71 attr_rangreqoppsize = Attribute("RangReqOppSize",
72 "The ranging opportunity size in symbols",
77 flags = Flags.Reserved | Flags.Construct)
79 cls._register_attribute(attr_rangreqoppsize)
81 attr_bwreqoppsize = Attribute("BwReqOppSize",
82 "The bandwidth request opportunity size in symbols",
87 flags = Flags.Reserved | Flags.Construct)
89 cls._register_attribute(attr_bwreqoppsize)
91 attr_maxrangcorrectionretries = Attribute("MaxRangCorrectionRetries",
92 "Number of retries on contention Ranging Requests",
97 flags = Flags.Reserved | Flags.Construct)
99 cls._register_attribute(attr_maxrangcorrectionretries)
101 attr_mtu = Attribute("Mtu",
102 "The MAC-level Maximum Transmission Unit",
103 type = Types.Integer,
107 flags = Flags.Reserved | Flags.Construct)
109 cls._register_attribute(attr_mtu)
111 attr_rtg = Attribute("RTG",
112 "receive/transmit transition gap.",
113 type = Types.Integer,
117 flags = Flags.Reserved | Flags.Construct)
119 cls._register_attribute(attr_rtg)
121 attr_ttg = Attribute("TTG",
122 "transmit/receive transition gap.",
123 type = Types.Integer,
127 flags = Flags.Reserved | Flags.Construct)
129 cls._register_attribute(attr_ttg)
134 def _register_traces(cls):
136 bstx = Trace("BSTx", "A packet has been received from higher layers and is being processed in preparation for queueing for transmission.")
138 cls._register_trace(bstx)
140 bstxdrop = Trace("BSTxDrop", "A packet has been dropped in the MAC layer before being queued for transmission.")
142 cls._register_trace(bstxdrop)
144 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,")
146 cls._register_trace(bspromiscrx)
148 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,")
150 cls._register_trace(bsrx)
152 bsrxdrop = Trace("BSRxDrop", "A packet has been dropped in the MAC layer after it has been passed up from the physical layer.")
154 cls._register_trace(bsrxdrop)
156 rx = Trace("Rx", "Receive trace")
158 cls._register_trace(rx)
160 tx = Trace("Tx", "Transmit trace")
162 cls._register_trace(tx)
166 def __init__(self, ec, guid):
167 super(NS3BaseStationNetDevice, self).__init__(ec, guid)
168 self._home = "ns3-base-station-net-device-%s" % self.guid