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 NS3SubscriberStationNetDevice(NS3BaseNetDevice):
27 _rtype = "ns3::SubscriberStationNetDevice"
30 def _register_attributes(cls):
32 attr_lostdlmapinterval = Attribute("LostDlMapInterval",
33 "Time since last received DL-MAP message before downlink synchronization is considered lost. Maximum is 600ms",
35 default = "+500000000.0ns",
38 flags = Flags.Reserved | Flags.Construct)
40 cls._register_attribute(attr_lostdlmapinterval)
42 attr_lostulmapinterval = Attribute("LostUlMapInterval",
43 "Time since last received UL-MAP before uplink synchronization is considered lost, maximum is 600.",
45 default = "+500000000.0ns",
48 flags = Flags.Reserved | Flags.Construct)
50 cls._register_attribute(attr_lostulmapinterval)
52 attr_maxdcdinterval = Attribute("MaxDcdInterval",
53 "Maximum time between transmission of DCD messages. Maximum is 10s",
55 default = "+10000000000.0ns",
58 flags = Flags.Reserved | Flags.Construct)
60 cls._register_attribute(attr_maxdcdinterval)
62 attr_maxucdinterval = Attribute("MaxUcdInterval",
63 "Maximum time between transmission of UCD messages. Maximum is 10s",
65 default = "+10000000000.0ns",
68 flags = Flags.Reserved | Flags.Construct)
70 cls._register_attribute(attr_maxucdinterval)
72 attr_intervalt1 = Attribute("IntervalT1",
73 "Wait for DCD timeout. Maximum is 5*maxDcdInterval",
75 default = "+50000000000.0ns",
78 flags = Flags.Reserved | Flags.Construct)
80 cls._register_attribute(attr_intervalt1)
82 attr_intervalt2 = Attribute("IntervalT2",
83 "Wait for broadcast ranging timeout, i.e., wait for initial ranging opportunity. Maximum is 5*Ranging interval",
85 default = "+10000000000.0ns",
88 flags = Flags.Reserved | Flags.Construct)
90 cls._register_attribute(attr_intervalt2)
92 attr_intervalt3 = Attribute("IntervalT3",
93 "ranging Response reception timeout following the transmission of a ranging request. Maximum is 200ms",
95 default = "+200000000.0ns",
98 flags = Flags.Reserved | Flags.Construct)
100 cls._register_attribute(attr_intervalt3)
102 attr_intervalt7 = Attribute("IntervalT7",
103 "wait for DSA/DSC/DSD Response timeout. Maximum is 1s",
105 default = "+100000000.0ns",
108 flags = Flags.Reserved | Flags.Construct)
110 cls._register_attribute(attr_intervalt7)
112 attr_intervalt12 = Attribute("IntervalT12",
113 "Wait for UCD descriptor.Maximum is 5*MaxUcdInterval",
115 default = "+10000000000.0ns",
118 flags = Flags.Reserved | Flags.Construct)
120 cls._register_attribute(attr_intervalt12)
122 attr_intervalt20 = Attribute("IntervalT20",
123 "Time the SS searches for preambles on a given channel. Minimum is 2 MAC frames",
125 default = "+500000000.0ns",
128 flags = Flags.Reserved | Flags.Construct)
130 cls._register_attribute(attr_intervalt20)
132 attr_intervalt21 = Attribute("IntervalT21",
133 "time the SS searches for (decodable) DL-MAP on a given channel",
135 default = "+10000000000.0ns",
138 flags = Flags.Reserved | Flags.Construct)
140 cls._register_attribute(attr_intervalt21)
142 attr_maxcontentionrangingretries = Attribute("MaxContentionRangingRetries",
143 "Number of retries on contention Ranging Requests",
144 type = Types.Integer,
148 flags = Flags.Reserved | Flags.Construct)
150 cls._register_attribute(attr_maxcontentionrangingretries)
152 attr_mtu = Attribute("Mtu",
153 "The MAC-level Maximum Transmission Unit",
154 type = Types.Integer,
158 flags = Flags.Reserved | Flags.Construct)
160 cls._register_attribute(attr_mtu)
162 attr_rtg = Attribute("RTG",
163 "receive/transmit transition gap.",
164 type = Types.Integer,
168 flags = Flags.Reserved | Flags.Construct)
170 cls._register_attribute(attr_rtg)
172 attr_ttg = Attribute("TTG",
173 "transmit/receive transition gap.",
174 type = Types.Integer,
178 flags = Flags.Reserved | Flags.Construct)
180 cls._register_attribute(attr_ttg)
185 def _register_traces(cls):
187 sstxdrop = Trace("SSTxDrop", "A packet has been dropped in the MAC layer before being queued for transmission.")
189 cls._register_trace(sstxdrop)
191 sspromiscrx = Trace("SSPromiscRx", "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,")
193 cls._register_trace(sspromiscrx)
195 ssrx = Trace("SSRx", "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,")
197 cls._register_trace(ssrx)
199 ssrxdrop = Trace("SSRxDrop", "A packet has been dropped in the MAC layer after it has been passed up from the physical layer.")
201 cls._register_trace(ssrxdrop)
203 rx = Trace("Rx", "Receive trace")
205 cls._register_trace(rx)
207 tx = Trace("Tx", "Transmit trace")
209 cls._register_trace(tx)
213 def __init__(self, ec, guid):
214 super(NS3SubscriberStationNetDevice, self).__init__(ec, guid)
215 self._home = "ns3-subscriber-station-net-device-%s" % self.guid