2 # NEPI, a framework to manage network experiments
3 # Copyright (C) 2014 INRIA
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;
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.
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/>.
17 # Author: Alina Quereilhac <alina.quereilhac@inria.fr>
19 from nepi.execution.resource import clsinit_copy
20 from nepi.resources.ns3.ns3netdevice import NS3BaseNetDevice
23 class NS3BaseFdNetDevice(NS3BaseNetDevice):
24 _rtype = "abstract::ns3::FdNetDevice"
27 def _rms_to_wait(self):
28 rms = set([self.node])
31 def _configure_mac_address(self):
32 # The wifimac is the one responsible for
33 # configuring the MAC address
36 def _connect_object(self):
38 if node and node.uuid not in self.connected:
39 self.simulation.invoke(node.uuid, "AddDevice", self.uuid)
40 self._connected.add(node.uuid)
42 def _instantiate_object(self):
43 """ just validate that the simulator is in real time
44 mode, otherwise it is not going to work
47 mode = self.simulation.get("simulatorImplementationType")
48 if mode != "ns3::RealtimeSimulatorImpl":
49 msg = "The simulation must run in real time!!"
51 raise RuntimeError(msg)
53 super(NS3BaseFdNetDevice, self)._instantiate_object()
56 address = self.simulation.invoke(self.uuid, "recvFD")