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