README moves to markdown
[nepi.git] / nepi / resources / ns3 / classes / base_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 NS3BaseStationNetDevice(NS3BaseNetDevice):
26     _rtype = "ns3::BaseStationNetDevice"
27
28     @classmethod
29     def _register_attributes(cls):
30         
31         attr_initialranginterval = Attribute("InitialRangInterval",
32             "Time between Initial Ranging regions assigned by the BS. Maximum is 2s",
33             type = Types.String,
34             default = "+50000000.0ns",  
35             allowed = None,
36             range = None,    
37             flags = Flags.Reserved | Flags.Construct)
38
39         cls._register_attribute(attr_initialranginterval)
40
41         attr_dcdinterval = Attribute("DcdInterval",
42             "Time between transmission of DCD messages. Maximum value is 10s.",
43             type = Types.String,
44             default = "+3000000000.0ns",  
45             allowed = None,
46             range = None,    
47             flags = Flags.Reserved | Flags.Construct)
48
49         cls._register_attribute(attr_dcdinterval)
50
51         attr_ucdinterval = Attribute("UcdInterval",
52             "Time between transmission of UCD messages. Maximum value is 10s.",
53             type = Types.String,
54             default = "+3000000000.0ns",  
55             allowed = None,
56             range = None,    
57             flags = Flags.Reserved | Flags.Construct)
58
59         cls._register_attribute(attr_ucdinterval)
60
61         attr_intervalt8 = Attribute("IntervalT8",
62             "Wait for DSA/DSC Acknowledge timeout. Maximum 300ms.",
63             type = Types.String,
64             default = "+50000000.0ns",  
65             allowed = None,
66             range = None,    
67             flags = Flags.Reserved | Flags.Construct)
68
69         cls._register_attribute(attr_intervalt8)
70
71         attr_rangreqoppsize = Attribute("RangReqOppSize",
72             "The ranging opportunity size in symbols",
73             type = Types.Integer,
74             default = "8",  
75             allowed = None,
76             range = None,    
77             flags = Flags.Reserved | Flags.Construct)
78
79         cls._register_attribute(attr_rangreqoppsize)
80
81         attr_bwreqoppsize = Attribute("BwReqOppSize",
82             "The bandwidth request opportunity size in symbols",
83             type = Types.Integer,
84             default = "2",  
85             allowed = None,
86             range = None,    
87             flags = Flags.Reserved | Flags.Construct)
88
89         cls._register_attribute(attr_bwreqoppsize)
90
91         attr_maxrangcorrectionretries = Attribute("MaxRangCorrectionRetries",
92             "Number of retries on contention Ranging Requests",
93             type = Types.Integer,
94             default = "16",  
95             allowed = None,
96             range = None,    
97             flags = Flags.Reserved | Flags.Construct)
98
99         cls._register_attribute(attr_maxrangcorrectionretries)
100
101         attr_mtu = Attribute("Mtu",
102             "The MAC-level Maximum Transmission Unit",
103             type = Types.Integer,
104             default = "1400",  
105             allowed = None,
106             range = None,    
107             flags = Flags.Reserved | Flags.Construct)
108
109         cls._register_attribute(attr_mtu)
110
111         attr_rtg = Attribute("RTG",
112             "receive/transmit transition gap.",
113             type = Types.Integer,
114             default = "0",  
115             allowed = None,
116             range = None,    
117             flags = Flags.Reserved | Flags.Construct)
118
119         cls._register_attribute(attr_rtg)
120
121         attr_ttg = Attribute("TTG",
122             "transmit/receive transition gap.",
123             type = Types.Integer,
124             default = "0",  
125             allowed = None,
126             range = None,    
127             flags = Flags.Reserved | Flags.Construct)
128
129         cls._register_attribute(attr_ttg)
130
131
132
133     @classmethod
134     def _register_traces(cls):
135         
136         bstx = Trace("BSTx", "A packet has been received from higher layers and is being processed in preparation for queueing for transmission.")
137
138         cls._register_trace(bstx)
139
140         bstxdrop = Trace("BSTxDrop", "A packet has been dropped in the MAC layer before being queued for transmission.")
141
142         cls._register_trace(bstxdrop)
143
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,")
145
146         cls._register_trace(bspromiscrx)
147
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,")
149
150         cls._register_trace(bsrx)
151
152         bsrxdrop = Trace("BSRxDrop", "A packet has been dropped in the MAC layer after it has been passed up from the physical layer.")
153
154         cls._register_trace(bsrxdrop)
155
156         rx = Trace("Rx", "Receive trace")
157
158         cls._register_trace(rx)
159
160         tx = Trace("Tx", "Transmit trace")
161
162         cls._register_trace(tx)
163
164
165
166     def __init__(self, ec, guid):
167         super(NS3BaseStationNetDevice, self).__init__(ec, guid)
168         self._home = "ns3-base-station-net-device-%s" % self.guid