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