README moves to markdown
[nepi.git] / nepi / resources / ns3 / ns3wifinetdevice.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 # Author: Alina Quereilhac <alina.quereilhac@inria.fr>
18
19 from nepi.execution.resource import clsinit_copy
20 from nepi.resources.ns3.ns3netdevice import NS3BaseNetDevice
21
22 WIFI_STANDARDS = dict({
23     "WIFI_PHY_STANDARD_holland": 5,
24     "WIFI_PHY_STANDARD_80211p_SCH": 7,
25     "WIFI_PHY_STANDARD_80211_5Mhz": 4,
26     "WIFI_PHY_UNKNOWN": 8,
27     "WIFI_PHY_STANDARD_80211_10Mhz": 3,
28     "WIFI_PHY_STANDARD_80211g": 2,
29     "WIFI_PHY_STANDARD_80211p_CCH": 6,
30     "WIFI_PHY_STANDARD_80211a": 0,
31     "WIFI_PHY_STANDARD_80211b": 1
32 })
33
34 @clsinit_copy
35 class NS3BaseWifiNetDevice(NS3BaseNetDevice):
36     _rtype = "abstract::ns3::WifiNetDevice"
37
38     @property
39     def _rms_to_wait(self):
40         rms = set([self.node])
41         return rms
42
43     def _configure_mac_address(self):
44         # The wifimac is the one responsible for
45         # configuring the MAC address
46         pass
47
48     def _connect_object(self):
49         node = self.node
50         if node and node.uuid not in self.connected:
51             self.simulation.invoke(node.uuid, "AddDevice", self.uuid)
52             self._connected.add(node.uuid)
53