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 NS3SubscriberStationNetDevice(NS3BaseNetDevice):
26 _rtype = "ns3::SubscriberStationNetDevice"
29 def _register_attributes(cls):
31 attr_lostdlmapinterval = Attribute("LostDlMapInterval",
32 "Time since last received DL-MAP message before downlink synchronization is considered lost. Maximum is 600ms",
34 default = "+500000000.0ns",
37 flags = Flags.Reserved | Flags.Construct)
39 cls._register_attribute(attr_lostdlmapinterval)
41 attr_lostulmapinterval = Attribute("LostUlMapInterval",
42 "Time since last received UL-MAP before uplink synchronization is considered lost, maximum is 600.",
44 default = "+500000000.0ns",
47 flags = Flags.Reserved | Flags.Construct)
49 cls._register_attribute(attr_lostulmapinterval)
51 attr_maxdcdinterval = Attribute("MaxDcdInterval",
52 "Maximum time between transmission of DCD messages. Maximum is 10s",
54 default = "+10000000000.0ns",
57 flags = Flags.Reserved | Flags.Construct)
59 cls._register_attribute(attr_maxdcdinterval)
61 attr_maxucdinterval = Attribute("MaxUcdInterval",
62 "Maximum time between transmission of UCD messages. Maximum is 10s",
64 default = "+10000000000.0ns",
67 flags = Flags.Reserved | Flags.Construct)
69 cls._register_attribute(attr_maxucdinterval)
71 attr_intervalt1 = Attribute("IntervalT1",
72 "Wait for DCD timeout. Maximum is 5*maxDcdInterval",
74 default = "+50000000000.0ns",
77 flags = Flags.Reserved | Flags.Construct)
79 cls._register_attribute(attr_intervalt1)
81 attr_intervalt2 = Attribute("IntervalT2",
82 "Wait for broadcast ranging timeout, i.e., wait for initial ranging opportunity. Maximum is 5*Ranging interval",
84 default = "+10000000000.0ns",
87 flags = Flags.Reserved | Flags.Construct)
89 cls._register_attribute(attr_intervalt2)
91 attr_intervalt3 = Attribute("IntervalT3",
92 "ranging Response reception timeout following the transmission of a ranging request. Maximum is 200ms",
94 default = "+200000000.0ns",
97 flags = Flags.Reserved | Flags.Construct)
99 cls._register_attribute(attr_intervalt3)
101 attr_intervalt7 = Attribute("IntervalT7",
102 "wait for DSA/DSC/DSD Response timeout. Maximum is 1s",
104 default = "+100000000.0ns",
107 flags = Flags.Reserved | Flags.Construct)
109 cls._register_attribute(attr_intervalt7)
111 attr_intervalt12 = Attribute("IntervalT12",
112 "Wait for UCD descriptor.Maximum is 5*MaxUcdInterval",
114 default = "+10000000000.0ns",
117 flags = Flags.Reserved | Flags.Construct)
119 cls._register_attribute(attr_intervalt12)
121 attr_intervalt20 = Attribute("IntervalT20",
122 "Time the SS searches for preambles on a given channel. Minimum is 2 MAC frames",
124 default = "+500000000.0ns",
127 flags = Flags.Reserved | Flags.Construct)
129 cls._register_attribute(attr_intervalt20)
131 attr_intervalt21 = Attribute("IntervalT21",
132 "time the SS searches for (decodable) DL-MAP on a given channel",
134 default = "+10000000000.0ns",
137 flags = Flags.Reserved | Flags.Construct)
139 cls._register_attribute(attr_intervalt21)
141 attr_maxcontentionrangingretries = Attribute("MaxContentionRangingRetries",
142 "Number of retries on contention Ranging Requests",
143 type = Types.Integer,
147 flags = Flags.Reserved | Flags.Construct)
149 cls._register_attribute(attr_maxcontentionrangingretries)
151 attr_mtu = Attribute("Mtu",
152 "The MAC-level Maximum Transmission Unit",
153 type = Types.Integer,
157 flags = Flags.Reserved | Flags.Construct)
159 cls._register_attribute(attr_mtu)
161 attr_rtg = Attribute("RTG",
162 "receive/transmit transition gap.",
163 type = Types.Integer,
167 flags = Flags.Reserved | Flags.Construct)
169 cls._register_attribute(attr_rtg)
171 attr_ttg = Attribute("TTG",
172 "transmit/receive transition gap.",
173 type = Types.Integer,
177 flags = Flags.Reserved | Flags.Construct)
179 cls._register_attribute(attr_ttg)
184 def _register_traces(cls):
186 sstxdrop = Trace("SSTxDrop", "A packet has been dropped in the MAC layer before being queued for transmission.")
188 cls._register_trace(sstxdrop)
190 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,")
192 cls._register_trace(sspromiscrx)
194 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,")
196 cls._register_trace(ssrx)
198 ssrxdrop = Trace("SSRxDrop", "A packet has been dropped in the MAC layer after it has been passed up from the physical layer.")
200 cls._register_trace(ssrxdrop)
202 rx = Trace("Rx", "Receive trace")
204 cls._register_trace(rx)
206 tx = Trace("Tx", "Transmit trace")
208 cls._register_trace(tx)
212 def __init__(self, ec, guid):
213 super(NS3SubscriberStationNetDevice, self).__init__(ec, guid)
214 self._home = "ns3-subscriber-station-net-device-%s" % self.guid