18441c225124fad34dc502018746e88bb89e5764
[nepi.git] / src / nepi / resources / ns3 / classes / subscriber_station_net_device.py
1 #
2 #    NEPI, a framework to manage network experiments
3 #    Copyright (C) 2014 INRIA
4 #
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.
9 #
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.
14 #
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/>.
17 #
18
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, \
22         ResourceState, reschedule_delay
23 from nepi.resources.ns3.ns3netdevice import NS3BaseNetDevice 
24
25 @clsinit_copy
26 class NS3SubscriberStationNetDevice(NS3BaseNetDevice):
27     _rtype = "ns3::SubscriberStationNetDevice"
28
29     @classmethod
30     def _register_attributes(cls):
31         
32         attr_lostdlmapinterval = Attribute("LostDlMapInterval",
33             "Time since last received DL-MAP message before downlink synchronization is considered lost. Maximum is 600ms",
34             type = Types.String,
35             default = "+500000000.0ns",  
36             allowed = None,
37             range = None,    
38             flags = Flags.Reserved | Flags.Construct)
39
40         cls._register_attribute(attr_lostdlmapinterval)
41
42         attr_lostulmapinterval = Attribute("LostUlMapInterval",
43             "Time since last received UL-MAP before uplink synchronization is considered lost, maximum is 600.",
44             type = Types.String,
45             default = "+500000000.0ns",  
46             allowed = None,
47             range = None,    
48             flags = Flags.Reserved | Flags.Construct)
49
50         cls._register_attribute(attr_lostulmapinterval)
51
52         attr_maxdcdinterval = Attribute("MaxDcdInterval",
53             "Maximum time between transmission of DCD messages. Maximum is 10s",
54             type = Types.String,
55             default = "+10000000000.0ns",  
56             allowed = None,
57             range = None,    
58             flags = Flags.Reserved | Flags.Construct)
59
60         cls._register_attribute(attr_maxdcdinterval)
61
62         attr_maxucdinterval = Attribute("MaxUcdInterval",
63             "Maximum time between transmission of UCD messages. Maximum is 10s",
64             type = Types.String,
65             default = "+10000000000.0ns",  
66             allowed = None,
67             range = None,    
68             flags = Flags.Reserved | Flags.Construct)
69
70         cls._register_attribute(attr_maxucdinterval)
71
72         attr_intervalt1 = Attribute("IntervalT1",
73             "Wait for DCD timeout. Maximum is 5*maxDcdInterval",
74             type = Types.String,
75             default = "+50000000000.0ns",  
76             allowed = None,
77             range = None,    
78             flags = Flags.Reserved | Flags.Construct)
79
80         cls._register_attribute(attr_intervalt1)
81
82         attr_intervalt2 = Attribute("IntervalT2",
83             "Wait for broadcast ranging timeout, i.e., wait for initial ranging opportunity. Maximum is 5*Ranging interval",
84             type = Types.String,
85             default = "+10000000000.0ns",  
86             allowed = None,
87             range = None,    
88             flags = Flags.Reserved | Flags.Construct)
89
90         cls._register_attribute(attr_intervalt2)
91
92         attr_intervalt3 = Attribute("IntervalT3",
93             "ranging Response reception timeout following the transmission of a ranging request. Maximum is 200ms",
94             type = Types.String,
95             default = "+200000000.0ns",  
96             allowed = None,
97             range = None,    
98             flags = Flags.Reserved | Flags.Construct)
99
100         cls._register_attribute(attr_intervalt3)
101
102         attr_intervalt7 = Attribute("IntervalT7",
103             "wait for DSA/DSC/DSD Response timeout. Maximum is 1s",
104             type = Types.String,
105             default = "+100000000.0ns",  
106             allowed = None,
107             range = None,    
108             flags = Flags.Reserved | Flags.Construct)
109
110         cls._register_attribute(attr_intervalt7)
111
112         attr_intervalt12 = Attribute("IntervalT12",
113             "Wait for UCD descriptor.Maximum is 5*MaxUcdInterval",
114             type = Types.String,
115             default = "+10000000000.0ns",  
116             allowed = None,
117             range = None,    
118             flags = Flags.Reserved | Flags.Construct)
119
120         cls._register_attribute(attr_intervalt12)
121
122         attr_intervalt20 = Attribute("IntervalT20",
123             "Time the SS searches for preambles on a given channel. Minimum is 2 MAC frames",
124             type = Types.String,
125             default = "+500000000.0ns",  
126             allowed = None,
127             range = None,    
128             flags = Flags.Reserved | Flags.Construct)
129
130         cls._register_attribute(attr_intervalt20)
131
132         attr_intervalt21 = Attribute("IntervalT21",
133             "time the SS searches for (decodable) DL-MAP on a given channel",
134             type = Types.String,
135             default = "+10000000000.0ns",  
136             allowed = None,
137             range = None,    
138             flags = Flags.Reserved | Flags.Construct)
139
140         cls._register_attribute(attr_intervalt21)
141
142         attr_maxcontentionrangingretries = Attribute("MaxContentionRangingRetries",
143             "Number of retries on contention Ranging Requests",
144             type = Types.Integer,
145             default = "16",  
146             allowed = None,
147             range = None,    
148             flags = Flags.Reserved | Flags.Construct)
149
150         cls._register_attribute(attr_maxcontentionrangingretries)
151
152         attr_mtu = Attribute("Mtu",
153             "The MAC-level Maximum Transmission Unit",
154             type = Types.Integer,
155             default = "1400",  
156             allowed = None,
157             range = None,    
158             flags = Flags.Reserved | Flags.Construct)
159
160         cls._register_attribute(attr_mtu)
161
162         attr_rtg = Attribute("RTG",
163             "receive/transmit transition gap.",
164             type = Types.Integer,
165             default = "0",  
166             allowed = None,
167             range = None,    
168             flags = Flags.Reserved | Flags.Construct)
169
170         cls._register_attribute(attr_rtg)
171
172         attr_ttg = Attribute("TTG",
173             "transmit/receive transition gap.",
174             type = Types.Integer,
175             default = "0",  
176             allowed = None,
177             range = None,    
178             flags = Flags.Reserved | Flags.Construct)
179
180         cls._register_attribute(attr_ttg)
181
182
183
184     @classmethod
185     def _register_traces(cls):
186         
187         sstxdrop = Trace("SSTxDrop", "A packet has been dropped in the MAC layer before being queued for transmission.")
188
189         cls._register_trace(sstxdrop)
190
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,")
192
193         cls._register_trace(sspromiscrx)
194
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,")
196
197         cls._register_trace(ssrx)
198
199         ssrxdrop = Trace("SSRxDrop", "A packet has been dropped in the MAC layer after it has been passed up from the physical layer.")
200
201         cls._register_trace(ssrxdrop)
202
203         rx = Trace("Rx", "Receive trace")
204
205         cls._register_trace(rx)
206
207         tx = Trace("Tx", "Transmit trace")
208
209         cls._register_trace(tx)
210
211
212
213     def __init__(self, ec, guid):
214         super(NS3SubscriberStationNetDevice, self).__init__(ec, guid)
215         self._home = "ns3-subscriber-station-net-device-%s" % self.guid